import axios from './request';

export default {
  getPapers(data) {
    return axios.get('/papers', {
      params: data,
    });
  },
  getPaper(id) {
    return axios.get(`/papers/${id}`);
  },
  addPapers(data) {
    return axios.post('/papers', data, {
      headers: {
        'Content-Type': 'application/json;charset=utf-8',
      },
      transformRequest: [
        (d) => JSON.stringify(d),
      ],
    });
  },
  deletePapers(id) {
    return axios.delete(`/papers/${id}`);
  },
  papersExist(data) {
    return axios.get('/papers/exist', {
      params: data,
    });
  },
  editPapers(id, data) {
    return axios.put(`/papers/${id}`, data, {
      headers: {
        'Content-Type': 'application/json;charset=utf-8',
      },
      transformRequest: [
        (d) => JSON.stringify(d),
      ],
    });
  },
};
